// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
//   File Name: qjs_message_event.cpp
// Description: Bindings for MessageEvent
//      Author: Ziming Li
//     Created: 2022-05-08
// -------------------------------------------------
// Copyright (C) 2022 MingYang Software Technology.
// -------------------------------------------------

#include "./qjs_bindings.h"

#include "blinkit/blink/renderer/bindings/core/qjs/qjs.h"
#include "blinkit/blink/renderer/bindings/core/qjs/qjs_c_function_list_entries.h"
#include "blinkit/blink/renderer/core/events/custom_event.h"

/**
 * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent
 */

namespace BlinKit {
namespace qjs {

static JSValue GetDetail(JSContext *ctx, JSValueConst thisVal)
{
    CustomEvent *event = ScriptWrappable::Cast<CustomEvent>(thisVal);
    ASSERT(false); // BKTODO:
    return JS_UNDEFINED;
}

JSValue CreateCustomEventPrototype(JSContext *ctx, JSValue eventPrototype)
{
    static const JSCFunctionListEntry Funcs[] = {
        CGetSetEntry("detail", GetDetail, nullptr)
    };

    JSValue ret = JS_NewObjectProto(ctx, eventPrototype);
    JS_SetPropertyFunctionList(ctx, ret, Funcs, std::size(Funcs));
    return ret;
}

} // namespace qjs
} // namespace BlinKit
